package 期末练习;

public class Person {

    private int age;

    public int getAge;
    public Person(){
        this.age=0;
    }

    public void setAge(int age) {
        if (age >= 0 && age <= 150) {
            this.age = age;
        } else {
            System.out.println("年龄不合法");
        }
    }
        public int getAge(){
        return this.age;

}
}
